package org.example.myleet.p509;

public class Solution1 {

    private static int[] FIBS = new int[31];

    static {
        FIBS[1] = 1;
        for (int i=2; i<=30; i++) {
            FIBS[i] = FIBS[i-1] + FIBS[i-2];
        }
    }

    /**
     * O(1)
     * 0 ms
     * 缓存结果法
     */
    public int fib(int n) {
        return FIBS[n];
    }
}
